import Vue from 'vue'
/*
  按钮防抖自定义指令
*/


Vue.directive('debounce', {
  inserted: function (el, binding) {
    el.addEventListener('click', () => {
      clearTimeout(binding.value.timeoutId);
      binding.value.timeoutId = setTimeout(() => binding.value.callback(), binding.value.delay);
    });
  },
});
